<?php
/**
 * CreateTime: 2023/12/12 16:28
 * User:LinQ
 */

namespace App\Http\Requests\Role;

use App\Http\Requests\BasicFormRequests;

class RoleRequest extends BasicFormRequests
{
    protected $rule =[
        'role_id' => 'required',
        'role_name' => 'required',
        'auth_ids' => 'required',
        'user_ids' => 'required'
    ];

    public function __construct(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null)
    {
        $this->message = [
            'role_name.required'=>trans('message.request_required',[
                'name' => trans('key.role_name')
            ]),
            'user_ids.required'=>trans('message.request_required',[
                'name' => trans('key.user_name')
            ]),
            'auth_ids.required'=>trans('message.request_required',[
                'name' => trans('key.auth')
            ]),
            'role_id.required'=>trans('message.request_required',[
                'name' => trans('key.role')
            ]),
        ];
        parent::__construct($query, $request, $attributes, $cookies, $files, $server, $content);
    }


    protected $scene = [
        'create' => ['role_name'],
        'bind_user' => ['role_id','user_ids'],
        'bind_auth' => ['role_id','auth_ids'],
    ];
}
